<?php

class Api_Videos extends PhalApi_Api {

    public function getRules() {
        return array(
            'show_basic' => array(
                'clientId' => array('name' => 'client_id', 'require' => true, 'desc' => '应用Key'),
                'videoId' => array('name' => 'video_id', 'desc' => '视频ID'),
                'videoUrl' => array('name' => 'video_url', 'desc' => '视频播放页URL'),          
            ),
        );
    }

    /**
     * 单条视频基本信息(videos/show_basic)
     * 
     * @return string id 视频唯一ID 
     * @return string title 视频标题
     * @return string link 视频播放链接
     * @return string thumbnail 视频截图
     * @return int duration 视频时长，单位：秒
     * @return ... ...
     */
    public function show_basic() {
        $rs = '{
            "id" : "XMjg1MTcyNDQ0",
                "title" : "泡芙小姐的灯泡 11",
                "link" : "http://v.youku.com/v_show/id_XMjg1MTcyNDQ0.html",
                "thumbnail" : "http://g4.ykimg.com/0100641F464E1FC...",
                "duration" : "910",
                "category" : "原创",
                "state" : "normal",
                "published" : "2011-07-15 09:00:42",
                "description" : "当一个人在一座城市搬11次家。就意味着准备在这个城市买房了。",
                "player" : "http://player.youku.com/player.php/sid/XMjg1MTcyNDQ0/v.swf",
                "public_type" : "all",
                "copyright_type" : "original",
                "user" :
                {
                    "id" : 58921428,
                    "name" : "泡芙小姐",
                    "link" : "http://u.youku.com/user_show/id_UMjM1Njg1NzEy.html"
                },
                "operation_limit": ["COMMENT_DISABLED"],
                "streamtypes" : ["flv","flvhd","hd"]
        }';

        return json_decode($rs, true);
    }
}
